package protocoltcp;

import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel;

public class MyServerInitializer extends ChannelInitializer<SocketChannel> {
    @Override
    protected void initChannel(SocketChannel socketChannel) throws Exception {
        ChannelPipeline pipeline = socketChannel.pipeline();
        //自定义编码器
        pipeline.addLast("encoder",new MessageEncoder());
        //自定义解码器
        pipeline.addLast("decoder",new MessageDecoder());
        //自定义hander处理逻辑
        pipeline.addLast(new MyServerHander());
    }
}
